package com.liqiye.paymanager.util;

import com.liqiye.paymanager.config.PaymentProperties;
import com.stripe.StripeClient;
import lombok.Getter;
import org.springframework.stereotype.Component;

@Component
public class StripeClientUtil {

    @Getter
    private StripeClient client;

    public StripeClientUtil(PaymentProperties config) {
        PaymentProperties.Stripe stripe = config.getStripe();
        String secretKey = stripe.getSecretKey();

        this.client = StripeClient.builder()
                .setApiKey(secretKey)
                .setConnectTimeout(30 * 1000)  // 连接超时（milliseconds）
                .setReadTimeout(80 * 1000)  // 读取超时（milliseconds）
                .setMaxNetworkRetries(2)
                .build();
    }

}
